/* 
*  CSS TABLE OF CONTENTS
*   
*  1.0 - Globals
*  2.0 - Header
*  3.0 - Body
*    3.1 - Guacamole display
*    3.2 - Defaults classes by guacamole-common-js
*/

/*** 1.0 - Globals ***/

html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  display: grid;
  grid-template-rows: auto 1fr;
}

h5 {
  margin: 0;
  padding: 0;
}

/*** 2.0 - Header ***/

header {
  background: #f2f4f8;
  padding: 1em 1em 0.8em;
  box-shadow: 0px 2px 1px -1px rgb(0 0 0 / 20%),
    0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%);
}

.header__wrapper {
  max-width: 1250px;
  margin: 0 auto;
}

.toolbar {
  padding: 1em;
  display: flex;
  gap: 2em;
  flex-wrap: wrap;
}

.toolbar img {
  height: 40px;
}

.toolbar__state {
  flex-grow: 1;
  display: flex;
  gap: 1em;
  align-items: center;
  justify-content: center;
}

.toolbar__state img {
  width: 40px;
  background-color: #282828;
  border-radius: 50%;
  padding: 0.4em;
}

.toolbar__buttons {
  display: flex;
  justify-content: flex-end;
}

.toolbar__buttons > button,
.toolbar__buttons > select {
  max-height: 32px;
  margin-bottom: 0;
  width: auto;
}

@media (max-width: 768px) {
  .toolbar__state {
    justify-content: end;
    flex-direction: row-reverse;
  }
  .toolbar__buttons {
    flex-grow: 1;
  }
}

/*** 3.0 - Body ***/

main {
  background-color: #222431;
}

main > div {
  z-index: 1;
}

/*** 3.1 - Guacamole display ***/

.wrapper__display {
  width: 100%;
  height: 100%;

  display: flex;
  align-items: center;
  place-content: center;
}

#display {
  overflow: hidden;
  cursor: none;
}

#display.ssh {
  width: 100vw;
  height: 100%;
}

/*** 3.2 - Guacamole OSK ***/

.osk__container {
  z-index: 2;
  background: rgba(0, 0, 0, 0.59);
  position: absolute;
  top: 30%;
  left: 0;
  display: none;
  border: 1px solid #acacac;
  border-radius: 6px;
  box-shadow: 0 0 20px #acacac;
}

.osk__header {
  background: linear-gradient(to top, #ebebeb, #d5d5d5);
  color: #4d494d;

  user-select: none;
  cursor: default;
  
  border-top: 1px solid #f3f1f3;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;

  padding: 0.5em;
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.osk__header__buttons .close {
  background: #ff5c5c;
  font-size: 13px;
  font-weight: bold;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: inline-block;
}

.osk__header select {
  width: auto;
  margin: 0;
}

/*** 3.2 Defaults classes by guacamole-common-js ***/

.guac-keyboard {
  display: inline-block;
  width: 100%;

  margin: 0;
  padding: 0;
  cursor: default;

  text-align: left;
  vertical-align: middle;
}

.guac-keyboard,
.guac-keyboard * {
  overflow: hidden;
  white-space: nowrap;
}

.guac-keyboard .guac-keyboard-key-container {
  display: inline-block;
  margin: 0.05em;
  position: relative;
}

.guac-keyboard .guac-keyboard-key {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;

  background: #444;

  border: 0.125em solid #666;
  -moz-border-radius: 0.25em;
  -webkit-border-radius: 0.25em;
  -khtml-border-radius: 0.25em;
  border-radius: 0.25em;

  color: white;
  font-size: 40%;
  font-weight: lighter;
  text-align: center;
  white-space: pre;

  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25), 1px -1px 0 rgba(0, 0, 0, 0.25),
    -1px 1px 0 rgba(0, 0, 0, 0.25), -1px -1px 0 rgba(0, 0, 0, 0.25);
}

.guac-keyboard .guac-keyboard-key:hover {
  cursor: pointer;
}

.guac-keyboard .guac-keyboard-key.highlight {
  background: #666;
  border-color: #666;
}

/* Align some keys to the left */
.guac-keyboard .guac-keyboard-key-caps,
.guac-keyboard .guac-keyboard-key-enter,
.guac-keyboard .guac-keyboard-key-tab,
.guac-keyboard .guac-keyboard-key-lalt,
.guac-keyboard .guac-keyboard-key-ralt,
.guac-keyboard .guac-keyboard-key-alt-gr,
.guac-keyboard .guac-keyboard-key-lctrl,
.guac-keyboard .guac-keyboard-key-rctrl,
.guac-keyboard .guac-keyboard-key-lshift,
.guac-keyboard .guac-keyboard-key-rshift {
  text-align: left;
  padding-left: 0.75em;
}

/* Active shift */
.guac-keyboard.guac-keyboard-modifier-shift .guac-keyboard-key-rshift,
.guac-keyboard.guac-keyboard-modifier-shift .guac-keyboard-key-lshift,

/* Active ctrl */
.guac-keyboard.guac-keyboard-modifier-control .guac-keyboard-key-rctrl,
.guac-keyboard.guac-keyboard-modifier-control .guac-keyboard-key-lctrl,

/* Active alt */
.guac-keyboard.guac-keyboard-modifier-alt .guac-keyboard-key-ralt,
.guac-keyboard.guac-keyboard-modifier-alt .guac-keyboard-key-lalt,

/* Active alt-gr */
.guac-keyboard.guac-keyboard-modifier-alt-gr .guac-keyboard-key-alt-gr,

/* Active caps */
.guac-keyboard.guac-keyboard-modifier-caps .guac-keyboard-key-caps,

/* Active super */
.guac-keyboard.guac-keyboard-modifier-super .guac-keyboard-key-super {
  background: #882;
  border-color: #dd4;
}

.guac-keyboard .guac-keyboard-key.guac-keyboard-pressed {
  background: #822;
  border-color: #d44;
}

.guac-keyboard .guac-keyboard-group {
  line-height: 0;
}

.guac-keyboard .guac-keyboard-group.guac-keyboard-alpha,
.guac-keyboard .guac-keyboard-group.guac-keyboard-movement {
  display: inline-block;
  text-align: center;
  vertical-align: top;
}

.guac-keyboard .guac-keyboard-group.guac-keyboard-main {
  /* IE10 */
  display: -ms-flexbox;
  -ms-flex-align: stretch;
  -ms-flex-direction: row;

  /* Ancient Mozilla */
  display: -moz-box;
  -moz-box-align: stretch;
  -moz-box-orient: horizontal;

  /* Ancient WebKit */
  display: -webkit-box;
  -webkit-box-align: stretch;
  -webkit-box-orient: horizontal;

  /* Old WebKit */
  display: -webkit-flex;
  -webkit-align-items: stretch;
  -webkit-flex-direction: row;

  /* W3C */
  display: flex;
  align-items: stretch;
  flex-direction: row;
}

.guac-keyboard .guac-keyboard-group.guac-keyboard-movement {
  -ms-flex: 1 1 auto;
  -moz-box-flex: 1;
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
}

.guac-keyboard .guac-keyboard-gap {
  display: inline-block;
}

/* Hide keycaps requiring modifiers which are NOT currently active. */
.guac-keyboard:not(.guac-keyboard-modifier-caps)
.guac-keyboard-cap.guac-keyboard-requires-caps,

.guac-keyboard:not(.guac-keyboard-modifier-shift)
.guac-keyboard-cap.guac-keyboard-requires-shift,

.guac-keyboard:not(.guac-keyboard-modifier-alt-gr)
.guac-keyboard-cap.guac-keyboard-requires-alt-gr,

/* Hide keycaps NOT requiring modifiers which ARE currently active, where that
 modifier is used to determine which cap is displayed for the current key. */
.guac-keyboard.guac-keyboard-modifier-shift
.guac-keyboard-key.guac-keyboard-uses-shift
.guac-keyboard-cap:not(.guac-keyboard-requires-shift),

.guac-keyboard.guac-keyboard-modifier-caps
.guac-keyboard-key.guac-keyboard-uses-caps
.guac-keyboard-cap:not(.guac-keyboard-requires-caps),

.guac-keyboard.guac-keyboard-modifier-alt-gr
.guac-keyboard-key.guac-keyboard-uses-alt-gr
.guac-keyboard-cap:not(.guac-keyboard-requires-alt-gr) {
  display: none;
}

/* Fade out keys which do not use AltGr if AltGr is active */
.guac-keyboard.guac-keyboard-modifier-alt-gr
  .guac-keyboard-key:not(.guac-keyboard-uses-alt-gr):not(.guac-keyboard-key-alt-gr) {
  opacity: 0.5;
}
